package com.eco.mam.work.request.transform;

import java.io.BufferedReader;
import java.io.IOException;

import org.apache.log4j.Logger;

import com.eco.mam.work.DataException;
import com.eco.mam.work.request.RequestMap;
import com.eco.mam.work.request.ResponseMap;
/*This is core class which is responsible for transorming 
 * the csv file into an xml representaion*/
public class XMLTransformer implements GenericTransformer {

	static final Logger logger = Logger.getLogger(XMLTransformer.class);

	
	/*This method will transform a (Work Request) csv  file into an xml.
	 * And it will validated the work request and reject work request with
	 *  missing mandatory data.*/ 
	public ResponseMap transform(RequestMap requestMap) throws DataException {
		// TODOuto-generated method stub
		logger.debug("entering XMLTransformer.transform()");
		BufferedReader reader=(BufferedReader) requestMap.get("csvDataStream");
		
		
		try {
		
		//	String strCsvHeader = reader.readLine();
			new XMLTransformHelper().getXMLStreamWriter();
			
		
		
		} catch (DataException e) {
			throw new DataException("Error happened can not read file ",e);
			
		}  
		finally
		{
			if(reader!=null)
			{
				try {
					reader.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					logger.debug(e);
					
				}
			}
		}
	
		/*while (condition) {
			
		}*/
		return null;
	}
	
	
	{
		
		
	}
}
